<%@include file="/include/struts-tags.jsp" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<%@include file="/include/head.jsp" %>
<script>
function findItem(codigo){
    //opener.clean();
    var form = opener.document.getElementById("usuarioForm");
    form.cmd.value = "seleccionarUsuario";
    form.user.value = codigo;
    form.submit();
    self.close();
}
</script>
    <body>
        <br />
        <html:form action="/Usuario">
            <html:hidden property="cmd" value="buscarUsuario" />
            <table class="form">
                <caption class="titleSeg">B&uacute;squeda de Usuarios</caption>
                <tr class="campos">
                    <td class="label">Usuario:&nbsp;&nbsp;</td>
                    <td class="control"><html:text property="user" styleClass="tinput150" /></td>
                    <td width="50px"></td>
                    <td class="label">Perfil:&nbsp;&nbsp;</td>
                    <td class="control">
                        <html:select property="rol" styleClass="tinput150" >
                            <html:option value="">> Seleccione una opción <</html:option>
                            <logic:present name="rolesList" scope="request">
                                <html:options collection="rolesList" property="idRol" labelProperty="rol" />
                            </logic:present>
                        </html:select>
                    </td>
                </tr>
                <tr class="campos">
                    <td class="label">Nombres:&nbsp;&nbsp;</td>
                    <td class="control"><html:text property="nombres" styleClass="tinput150" /></td>
                    <td></td>
                    <td class="label">Apellidos:&nbsp;&nbsp;</td>
                    <td class="control"><html:text property="apellidos" styleClass="tinput150" /></td>
                </tr>
                <tr>
                    <td colspan="5" align="center">
                        <html:submit value="Buscar" />
                    </td>
                </tr>
            </table>
        </html:form>
        <hr />
        <br />
        <logic:present name="usuarioData" scope="request">
            <display:table pagesize="10" name="usuarioData" requestURI="" class="results" style="width:90%;" id="results">
                <display:column property="alias" title="" style="text-align:center;" decorator="com.uca.sisbec.decorators.BusquedaBecDecorator" sortable="true"/>
                <display:column property="alias" title="Usuario" sortable="true" />
                <display:column property="nombres" title="Nombres" sortable="true" />
                <display:column property="apellidos" title="Apellidos" sortable="true" />
                <display:column property="rol.rol" title="Perfil" sortable="true" />
            </display:table>
            <script>
                var table = document.getElementById("results");
                var rows = table.getElementsByTagName("tr");
                for (var i = 1; i < rows.length; i++) {
                        rows[i].onmouseover = function() {
                                this.className += ' hilite';
                        }
                        rows[i].onmouseout = function() {
                                this.className = this.className.replace(' hilite', '');
                        }
                }
            </script>
        </logic:present>
    </body>
</html>
